package cn.yunhe.controller;

import java.io.File;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadController {
	
	@Value("${saveDir}")
	private String saveDir;
	
	@RequestMapping("/user/add")
	public String addUser(MultipartFile[] files){
		for(MultipartFile a:files){
			try {
				a.transferTo(new File(saveDir,a.getOriginalFilename()));
			} catch (IllegalStateException | IOException e) {
				e.printStackTrace();
			}
		}
		return "";
	}
	
}
